package com.sscl.blesample.adapter;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseNodeAdapter;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.chad.library.adapter.base.entity.node.BaseNode;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.sscl.baselibrary.utils.BaseManager;
import com.sscl.baselibrary.utils.ToastUtil;
import com.sscl.blesample.R;
import com.sscl.blesample.adapter.entity.services_characteristics_list_entity.CharacteristicUuidItem;
import com.sscl.blesample.adapter.entity.services_characteristics_list_entity.ServiceUuidItem;
import com.sscl.blesample.adapter.provider.CharacteristicUuidProvider;
import com.sscl.blesample.adapter.provider.ServiceUuidProvider;

import java.util.List;


/**
 * @author jacke
 * @date 2018/1/22 0022
 */

public class ServicesCharacteristicsListAdapter extends BaseNodeAdapter {

    public static final int TYPE_SERVICE_UUID = 0;
    public static final int TYPE_CHARACTERISTIC_UUID = 1;
    public static final int TYPE_UNKNOWN = -1;
    public static final int EXPAND_COLLAPSE_PAYLOAD = 110;

    public ServicesCharacteristicsListAdapter() {
        super();
        addNodeProvider(new ServiceUuidProvider());
        addNodeProvider(new CharacteristicUuidProvider());
    }

    @Override
    protected int getItemType(@NonNull List<? extends BaseNode> data, int position) {
        BaseNode baseNode = data.get(position);
        if (baseNode instanceof ServiceUuidItem) {
            return TYPE_SERVICE_UUID;
        } else if (baseNode instanceof CharacteristicUuidItem) {
            return TYPE_CHARACTERISTIC_UUID;
        } else {
            return TYPE_UNKNOWN;
        }
    }
}
